Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Add clip limits to Nightshade floating point calculations #1989

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

greglucas
Copy link
Contributor

Depending on the values input to Nightshade, the floating point
precision could put the range for arccos outside of [-1, 1], which
in turn numpy returns as nan's, yielding bad geometries further
downstream. This patch clips the arccos calculations to [-1, 1] to
guarantee we aren't out of the valid floating point bounds.

Fixes #1988

Depending on the values input to Nightshade, the floating point
precision could put the range for arccos outside of [-1, 1], which
in turn numpy returns as nan's, yielding bad geometries further
downstream. This patch clips the arccos calculations to [-1, 1] to
guarantee we aren't out of the valid floating point bounds.
Copy link
Contributor

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sensible. I think the test failure looks unrelated?

@greglucas
Copy link
Contributor Author

Yes, it seems unrelated as there is no NightShade being used in that example.

@greglucas greglucas merged commit 129143a into SciTools:main Jan 21, 2022
@greglucas greglucas deleted the nightshade-fp branch January 21, 2022 20:32
@QuLogic QuLogic added this to the 0.20.3 milestone Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nightshade w/ refraction=-6.0 yields ValueError: GEOSGeom_createLinearRing_r returned a NULL pointer
3 participants